20. Exercise: Adding LiveData to AddTaskActivity

ANDFUN AAC L118 SC Adding LiveData To DetailActivity

At 1:07 Jose removes the observer.

Usually, we do not need to remove the observer as we want LiveData to reflect the state of the underlying data. In our case we are doing a one-time load, and we don’t want to listen to changes in the database.

Then, why are we using LiveData? Why don’t we keep the executor as it is instead?

When we progress in the lesson we will move this logic to the ViewModel. There we will benefit from the rest of advantages of LiveData, even if we have used it for a one-time load.